import type {ElForm} from 'element-plus'
import router from "../router";

export const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => {
    if (!formEl) return
    formEl.validate((valid) => {
        if (valid) {
            window.sessionStorage.setItem('t_k', '1dd22454d')
            console.log('submit!')
            router.push({path: '/home'})
        } else {
            console.log('error submit!')
            return false
        }
    })
}

export const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => {
    if (!formEl) return
    formEl.resetFields()
}